﻿@using Carer.Data
@using Carer.View
@{
    ViewBag.Title = "订单管理";
    Layout = "~/Views/Shared/_Layout.cshtml";

    var crewTypes = ViewBag.CrewTypes as IList<CrewType>;
    if (crewTypes == null)
    {
        crewTypes = new List<CrewType>();
    }

    var categories = ViewBag.Categories as IList<Category>;
    if (categories == null)
    {
        categories = new List<Category>();
    }

    var payments = ViewBag.Payments as IList<Payment>;
    if (payments == null)
    {
        payments = new List<Payment>();
    }
}

<div id="list" class="view">
    <div class="query">
        <ul class="tool">
            <li><button class="add btn btn-default"><span class="add"></span>增 加</button></li>
            <li><button class="delete btn btn-default"><span class="delete"></span> 删除选择</button></li>
        </ul>
        <form action="">
            <table>
                <tr>
                    <td class="title">客户姓名</td>
                    <td><input name="CustomerName" type="text" class="form-control" /></td>
                    <td class="title">服务类别</td>
                    <td>
                        <select name="Category" class="form-control">
                            <option value="">所有</option>
                            @foreach (var item in categories)
                            {
                            <option value="@item.Name">@item.Name</option>
                            }
                        </select>
                    </td>
                    <td class="title">病区</td>
                    <td><input name="Area" type="text" class="form-control" /></td>
                    <td class="title">病床</td>
                    <td><input name="Bed" type="text" class="form-control" /></td>
                    <td rowspan="2" class="query"><button class="query btn btn-primary"><i class="fa fa-search fa-lg"></i> 查 询</button></td>
                </tr>
                <tr>
                    <td class="title">服务单号</td>
                    <td><input name="Invoice" type="text" class="form-control" /></td>
                    <td class="title">开始</td>
                    <td><input name="From" type="text" class="date form-control" /></td>
                    <td class="title">结束</td>
                    <td><input name="To" type="text" class="date form-control" /></td>
                    <td class="title">订单状态</td>
                    <td>
                        <select name="State" class="form-control">
                            <option value="">所有</option>
                            <option selected="selected" value="0">订单排班</option>
                            <option value="256">订单完成</option>
                        </select>
                    </td>
                </tr>
            </table>
        </form>
    </div>

    <div class="list">
        <table class="list">
            <thead>
                <tr>
                    <th class="control"></th>
                    <th><input class="selall" type="checkbox" /></th>
                    <th>地址</th>
                    <th>客户</th>
                    <th>服务类别</th>
                    <th>服务项目</th>
                    <th>收费标准</th>
                    <th>开始时间</th>
                    <th>结束时间</th>
                    <th>订单状态</th>
                    <th colspan="3" class="action">操作</th>
                </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>
    <div id="lpager" class="jpager"></div>
</div>

<div id="edit" class="view edit">
    <div class="title"><span>订单信息</span></div>
    <form id="addOrder" action="">
        <input class="Id" name="Id" type="hidden" />
        <input class="OrderUnitId" name="OrderUnitId" type="hidden" />
        <input class="ServiceUnitId" name="ServiceUnitId" type="hidden" />
        <table>
            <tr>
                <td class="title"><font color="red">*</font> 服务项目：</td>
                <td class="content">
                    <input class="ServiceId" name="ServiceId" type="hidden" />
                    <div class="input-group">
                        <input class="ServiceName form-control" name="ServiceName" type="text" readonly="readonly" />
                        <span class="input-group-btn">
                            <button id="ServiceBrowser" class="btn btn-default"><i class="fa fa-lg fa-search"></i></button>
                        </span>

                    </div>
                </td>
                <td class="title">收费标准：</td>
                <td class="content"><input class="ServicePrice sum form-control" name="ServicePrice" readonly="readonly" type="text" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 客户姓名：</td>
                <td class="content">
                    <input class="CustomerId" name="CustomerId" type="hidden" />
                    <div class="input-group">
                        <input class="CustomerName form-control" name="CustomerName" type="text" readonly="readonly" />
                        <span class="input-group-btn">
                            <button id="CustomerBrowser" class="btn btn-default"><i class="fa fa-lg fa-search"></i></button>
                        </span>

                    </div>
                </td>
                <td class="title">电话：</td>
                <td class="content"><input class="CustomerTel form-control" name="CustomerTel" readonly="readonly" type="text" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 病区/病床：</td>
                <td class="content">
                    <div class="input-group">
                        <input class="Area form-control" name="Area" type="text" />
                        <span class="input-group-addon">/</span>
                        <input class="Bed form-control" name="Bed" type="text" />
                    </div>
                </td>
                <td class="title"><font color="red">*</font> 班次：</td>
                <td class="content">
                    <select class="Shift form-control" name="Shift">
                        <option class="default" value="0">全天</option>
                        <option value="1">白班</option>
                        <option value="2">夜班</option>
                    </select>
                </td>

            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 开始时间：</td>
                <td class="content"><input class="Start datetime form-control" name="Start" type="text" /></td>
                <td class="title">结束时间：</td>
                <td class="content"><input class="End datetime form-control" name="End" type="text" /></td>
            </tr>
            <tr>
                <td class="title">订单状态：</td>
                <td class="content">
                    <select class="State form-control" name="State">
                        <option class="default" value="0">订单排班</option>
                        <option value="256">订单完成</option>
                    </select>
                </td>
                <td class="title">所属公司：</td>
                <td class="content">
                    <select class="Company form-control" name="Company">
                        <option class="default">复医</option>
                        <option>珅昕</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="title">工作日：</td>
                <td class="content"><input class="Num sum form-control" name="Num" type="text" readonly="readonly" /></td>
                <td class="title">节假日：</td>
                <td class="content"><input class="Holidays sum form-control" name="Holidays" type="text" /></td>
            </tr>
            <tr>

                <td class="title">折扣：</td>
                <td class="content"><input class="Discount sum form-control" name="Discount" type="text" /></td>

                <td class="title">调整金额：</td>
                <td class="content"><input class="Adjust sum form-control" name="Adjust" type="text" /></td>
            </tr>
            <tr>
                <td class="title">总金额：</td>
                <td class="content"><input class="Charge form-control" name="Charge" type="text" readonly="readonly" /></td>

                <td class="title">预付：</td>
                <td class="content"><input class="Prepay form-control" name="Prepay" type="text" /></td>
            </tr>
            <tr>
                <td class="title">凭证类型：</td>
                <td class="content">
                    <select class="ReceiptType form-control" name="ReceiptType">
                        <option class="default">收据</option>
                        <option>发票</option>
                    </select>
                </td>

                <td class="title">凭证号：</td>
                <td class="content"><input class="ReceiptNo form-control" name="ReceiptNo" type="text" /></td>
            </tr>
            <tr>
                <td class="title">服务单号：</td>
                <td class="content"><input class="Invoice form-control" name="Invoice" type="text" /></td>

                <td class="title">签单人：</td>
                <td class="content"><input class="BillSigner form-control" name="BillSigner" type="text" /></td>
            </tr>
            <tr>
                <td class="title">结账人：</td>
                <td class="content"><input class="Receiver form-control" name="Receiver" type="text" /></td>

                <td class="title">备注：</td>
                <td class="content"><input class="Note form-control" name="Note" type="text" /></td>
            </tr>
        </table>
        <p class="submit">
            <button class="save btn btn-success" type="submit"><i class="fa fa-save fa-lg"></i> 保 存</button>
            <button class="cancel btn btn-danger"><i class="fa fa-close fa-lg"></i> 取 消</button>
        </p>
    </form>

</div>

<div id="schedule" class="view edit">
    <div class="title"><span>排班信息</span></div>
    <form id="EditSchedule" action="EditSchedule">
        <input class="Id" name="Id" type="hidden" />
        <table>
            <tr>
                <td class="title">订单编号：</td>
                <td class="content"><input class="OrderId form-control" name="OrderId" type="text" readonly="readonly" /></td>
                <td class="title">客户姓名：</td>
                <td class="content"><input class="CustomerName form-control" name="CustomerName" type="text" readonly="readonly" /></td>
            </tr>
            <tr>
                <td class="title">服务项目：</td>
                <td class="content"><input class="ServiceName form-control" name="ServiceName" type="text" readonly="readonly" /></td>
                <td class="title">收费标准：</td>
                <td class="content"><input class="ServicePrice pay form-control" name="ServicePrice" type="text" readonly="readonly" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 服务人员：</td>
                <td class="content">
                    <input class="CrewId" name="CrewId" type="hidden" />
                    <div class="input-group">
                        <input class="CrewName form-control" name="CrewName" type="text" readonly="readonly" />
                        <span class="input-group-btn">
                            <button id="CrewBrowser" class="btn btn-default"><i class="fa fa-lg fa-search"></i></button>
                        </span>
                    </div>
                </td>
                <td class="title">联系电话：</td>
                <td class="content"><input class="CrewTel form-control" name="CrewTel" type="text" readonly="readonly" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 服务时间：</td>
                <td class="content"><input class="Start datetime form-control" name="Start" type="text" /></td>
                <td class="title"><font color="red">*</font> 结束时间：</td>
                <td class="content"><input class="End datetime form-control" name="End" type="text" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 班次：</td>
                <td class="content">
                    <select class="Shift pay form-control" name="Shift">
                        <option value="0">全天</option>
                        <option value="1">白班</option>
                        <option value="2">夜班</option>
                    </select>
                </td>
                <td class="title">节假日：</td>
                <td class="content"><input class="IsHoliday pay form-control" name="IsHoliday" type="checkbox" /></td>
            </tr>
            <tr>
                <td class="title"><font color="red">*</font> 结算标准：</td>
                <td class="content">
                    <select class="PaymentId form-control" name="PaymentId">
                        @foreach (var item in payments)
                        {
                            <option data-ratio="@item.Ratio" value="@item.Id">@item.Name</option>
                        }
                    </select>
                </td>

                <td class="title"><font color="red">*</font> 分成比例：</td>
                <td class="content"><input class="Ratio pay form-control" name="Ratio" type="text" readonly="readonly" /></td>
            </tr>
            <tr>
                <td class="title">调整金额：</td>
                <td class="content"><input class="Adjust pay form-control" name="Adjust" type="text" /></td>

                <td class="title"><font color="red">*</font> 结算金额：</td>
                <td class="content"><input class="Pay form-control" name="Pay" type="text" readonly="readonly" /></td>
            </tr>
            <tr>
                <td class="title">客户评价：</td>
                <td class="content"><input class="Rate form-control" name="Rate" type="text" /></td>

                <td class="title">备注：</td>
                <td class="content"><input class="Note form-control" name="Note" type="text" /></td>
            </tr>
        </table>
        <p class="submit">
            <button class="save btn btn-success" type="submit"><i class="fa fa-save fa-lg"></i> 保 存</button>
            <button class="cancel btn btn-danger"><i class="fa fa-close fa-lg"></i> 取 消</button>
        </p>
    </form>

</div>

<div id="service" class="dialog" title="选择服务项目">
    <div class="query">
        <form action="">
            <ul>
                <li><label>服务项目</label><input name="Name" type="text" class="form-control" /></li>
                <li>
                    <label>服务类别</label>
                    <select name="Type" class="form-control">
                        <option value="">所有</option>
                        @foreach (var item in categories)
                        {
                            <option value="@item.Name">@item.Name</option>
                        }
                    </select>
                </li>
                <li><button class="query btn btn-primary"><i class="fa fa-search fa-lg"></i> 查 询</button></li>
            </ul>
        </form>
    </div>

    <div class="list">
        <table class="list">
            <thead>
                <tr>
                    <th>服务项目</th>
                    <th>服务类别</th>
                    <th>单位</th>
                    <th>单价</th>
                    <th>选择</th>
                </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>
    <div id="spager" class="jpager"></div>
</div>

<div id="customer" class="dialog" title="选择客户">
    <div class="query">
        <form action="">
            <ul>
                <li><label>姓名</label><input name="Name" type="text" class="form-control" /></li>
                <li><label>电话</label><input name="Tel" type="text" class="form-control" /></li>
                <li><button class="query btn btn-primary"><i class="fa fa-search fa-lg"></i> 查 询</button></li>
            </ul>
        </form>
    </div>
    <div class="list">
        <table class="list">
            <thead>
                <tr>
                    <th>姓名</th>
                    <th>电话</th>
                    <th>身份证号</th>
                    <th>住址</th>
                    <th>联系人</th>
                    <th>电话</th>
                    <th>关系</th>
                    <th>选 择</th>
                </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>
    <div id="cpager" class="jpager"></div>
</div>

<div id="crew" class="dialog" title="选择人员">
    <div class="query">
        <form action="">
            <ul>
                <li><label>姓名</label><input name="Name" type="text" class="form-control" /></li>
                <li>
                    <label>性质</label>
                    <select name="Type" class="form-control">
                        <option value="">所有</option>
                        @foreach (var item in crewTypes)
                        {
                            <option value="@item.Name">@item.Name</option>
                        }
                    </select>
                </li>
                <li>
                    <label>状态</label>
                    <select name="Status" class="form-control">
                        <option value="">所有</option>
                        <option selected="selected">在职</option>
                        <option>离职</option>
                    </select>
                </li>
                <li>
                    <label>技能</label>
                    <select name="Skill" class="form-control">
                        <option value="">所有</option>
                        @foreach (var item in categories)
                        {
                            <option value="@item.Name">@item.Name</option>
                        }
                    </select>
                </li>
                <li><button class="query btn btn-primary"><i class="fa fa-search fa-lg"></i> 查 询</button></li>
            </ul>
        </form>
    </div>
    <div class="list">
        <table class="list">
            <thead>
                <tr>
                    <th>姓名</th>
                    <th>性别</th>
                    <th>身份证</th>
                    <th>性质</th>
                    <th>技能</th>
                    <th>状态</th>
                    <th>结算标准</th>
                    <th>电话</th>
                    <th>所属单位</th>
                    <th>服务单位</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>
    <div id="wpager" class="jpager"></div>
</div>

@section Scripts {
    @Scripts.Render("~/Content/jQuery/date.format.js")
    @Scripts.Render("~/Content/Common/util.js?v=" + MvcApplication.TimeStamp)
    @Scripts.Render("~/Content/Business/order.js?v=" + MvcApplication.TimeStamp)
}